//
//  SRHomeworkPictureTableViewCell.m
//  StoryShow
//
//  Created by CyonLeuMBP on 2017/9/11.
//  Copyright © 2017年 qudiandu.cn. All rights reserved.
//

#import "SRHomeworkPictureTableViewCell.h"

NSString *const kSRHomeworkPictureTableViewCell = @"SRHomeworkPictureTableViewCell";

@implementation SRHomeworkPictureTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    
    self.backgroundColor = [UIColor clearColor];
    self.contentView.backgroundColor = [UIColor clearColor];
    self.iconImageView.backgroundColor = [UIColor whiteColor];
    self.iconImageView.clipsToBounds = YES;
    self.iconImageView.layer.cornerRadius = 5;
    self.iconImageView.layer.borderColor = [UIColor whiteColor].CGColor;
    self.iconImageView.layer.borderWidth = 0.5;
    
    self.titleLabel.backgroundColor = [UIColor colorWithHex:0x10aa14];
    self.titleLabel.layer.cornerRadius = 35/2.0;
    self.titleLabel.clipsToBounds = YES;
    
//    self.selectedBackgroundView = nil;
//    self.selectedBackgroundView = [[UIView alloc] init];
//    self.selectedBackgroundView.backgroundColor = [UIColor redColor];//[UIColor colorWithWhite:0 alpha:0.6];
//
//    [self.contentView addSubview:self.selectedBackgroundView];
//    
//    [self.selectedBackgroundView mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.edges.equalTo(self.iconImageView);
//    }];
    self.selectView.backgroundColor =  [UIColor colorWithWhite:0 alpha:0.6];
    self.selectView.clipsToBounds = YES;
    self.selectView.layer.cornerRadius = 5;
    self.selectionStyle = UITableViewCellSelectionStyleNone;
    
    self.selectView.hidden = YES;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
    if (self.isFinishDetail) {
        
    } else {
        self.selectView.hidden = !selected;
    }
    
}

- (void)setHighlighted:(BOOL)highlighted animated:(BOOL)animated {
    [super setHighlighted:highlighted animated:animated];
    if (self.isFinishDetail) {
        
    } else {
        self.selectView.hidden = !highlighted;
    }
}

- (void)updateCellInfo:(SRHomeworkAnswerModel *)item {
    
    self.titleLabel.text = item.key;
    [self.iconImageView fz_setImageWithDefaultPlaceholderWithURLString:item.pic];
    
    if ([item.key isEqualToString:@"A"]) {
        self.titleLabel.backgroundColor = [UIColor colorWithHex:0x10aa14];
    }
    else if ([item.key isEqualToString:@"B"]) {
        self.titleLabel.backgroundColor = [UIColor colorWithHex:0xffb32e];
    }
    else if ([item.key isEqualToString:@"C"]) {
        self.titleLabel.backgroundColor = [UIColor colorWithHex:0xee1515];
    }
    else if ([item.key isEqualToString:@"D"]) {
        self.titleLabel.backgroundColor = [UIColor colorWithHex:0xefe6de];
    }
    
}


@end
